/*
 * requesthandler.h
 *
 *  Created on: 01/02/2009
 *      Author: andre
 */

#ifndef REQUESTHANDLER_H_
#define REQUESTHANDLER_H_

#include "bencoder.h"

#define ERROR_GETTING_ANNOUNCE_PARAMETERS -1
#define FAILED_TO_IDENTIFY_REQUEST_TYPE -2

typedef struct announceparams {

    char     info_hash[20];
    char     peer_id[20];
    int      port;
    double   downloaded;
    double   uploaded;

    double   left;
    int      event;
    int      compact;
    int      numwant;
    char     key[20];

} AnnounceParameters;

int handleRequest(int sock);

int doAnnounce(AnnounceParameters tr, BencodedResponse *br);


#endif
